package com.woniu.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.controller.form.DeleteStaff;
import com.woniu.model.BmsDept;
import com.woniu.model.BmsRole;
import com.woniu.model.BmsUser;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Kevin Kwok
 * @since 2021-04-13
 */
public interface BmsUserMapper extends BaseMapper<BmsUser> {

    @Select("select * from bms_user where tel = #{tel}")
    BmsUser queryUserByTel(String tel);

    @Select("select * from bms_user where username = #{username}")
    BmsUser queryUserByName(String username);

    @Select("select * from bms_user")
    List<BmsUser> queryAllUser();
    @Select("select * from bms_role")
    List<BmsRole> queryAllRole();
    @Select("select * from bms_dept")
    List<BmsDept> queryAllDept();

    @Insert("insert into bms_user (username,password,sault,tel)values(#{username},#{password},#{sault},#{tel})")
    int addNewUser(BmsUser bmsUser);

    @Delete("delete from bms_user where username=#{username} and tel=#{tel}")
    int deleteStaff(DeleteStaff staff);

}
